<template>
  <div class="item_box">
    <div class="item" v-for="item in list" @click="goList(item)" :key="item.id">
      <h2>{{ item.cp002 }}</h2>
      <p>
        {{ item.wmdaName }}
      </p>
    </div>

  </div>
</template>

<script>

export default {
  // import 引入的组件需要注入到对象中才能使用
  components: {},
  props: {
    list: {
      type: Array
    },
    year: {
      type: [String, Number]
    },
    parentId: {
      type: [String, Number]
    }
  },
  data() {
    // 这里存放数据
    return {}
  },

  // 方法集合
  methods: {
    goList(data) {
      this.$router.push(
        {
          path: '/bigscreen/list',
          query: {
            catid: data.id,
            selyear: this.year,
            cp002: this.parentId
          }
        })
    }
  } // 如果页面有 keep-alive 缓存功能,这个函数会触发
}
</script>

<style scoped lang="scss">
.item_box {
  display: flex;
  flex-wrap: wrap;

  .item {
    width: 12.5%;
    height: 300px;
    border: 1px solid #dfd9bd;
    border-top: unset;
    border-left: unset;
    text-align: center;
    cursor: pointer;
  }

  .item:nth-child(-n+8) {
    border-top: 1px solid #dfd9bd;
  }

  .item:nth-child(8n+1) {
    border-left: 1px solid #dfd9bd;
  }

  p {
    text-align: left;
    font-size: 20px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 8;
    -webkit-box-orient: vertical;
    font-family: 微软雅黑;
    padding: 0 0.5em
  }
;

}
</style>

